package com.imooc.oho.util;

import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil;
import dx.util.TextinOcrUtil;

import java.util.Date;
import java.util.Scanner;

/**
 * create by duanx 2021/12/6

 *@classname: test
 *@author: duanx
 *@date: 2021/12/6 17:10
 **/
public class test {
    public int countNum(String str){
        //找到最后一个空格位置
        int index =  str.lastIndexOf(" ");
        String word = str;
        //如果有空格 截取最后一个单词，没有空格直接是只有一个单词
        if(index>0){
            word = str.substring(index);
        }
        //返回单词长度
        return word.length();
    }
    public static int countNumTwo(String str){
        int index = 0;
        for(int i = 0;i< str.length();i++){
            if(str.charAt(i)==' '){
                index = 0;
                i++;
            }
            index++;
        }

        return index;
    }

    public static void main(String[] args) {
        Date orderDate = DateUtil.parse("2021-12-02 12:00:00","yyyy-MM-dd HH:mm:ss");
        long  loseDay = DateUtil.between(orderDate,new Date(), DateUnit.DAY,false);

        System.out.println(TextinOcrUtil.TEXTIN_TEXT_READ_URL);

    }
}
